var _SOT_Date_Item_ = Class.create();
_SOT_Date_Item_.prototype = {
    initialize: function(){
        this.months = new Array();
        this.year = "";
    }
};

var SOTDate = Class.create();
SOTDate.prototype = {
    initialize: function(){
        this._dates = new Array();
        this._getTime();
        this._selectDate = new Date();
        this._max_target = "";
        this._min_target = "";
        this._maymonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
        this._initTarget();
    },
    
    _initTarget: function(){
        var dateobj = new Date();
        this._min_target = dateobj.getTime();
        this._max_target = this._min_target + 90 * 24 * 3600 * 1000;
        delete dateobj;
    },
    
    _getTime: function(){
        var tdate = new Date();
        var fdate = new Date();
        var y = 0;
        var m = 0;
        //fdate.setDate( tdate.getDate() + 45 );
        for (var i = 0; i < 90; i++) {
            fdate = new Date();
            fdate.setDate(tdate.getDate() + i);
            if (fdate.getFullYear() != y) {
                var item = new _SOT_Date_Item_();
                item.year = fdate.getFullYear();
                item.months.push(fdate.getMonth() + 1);
                y = item.year;
                m = fdate.getMonth() + 1;
                this._dates.push(item);
                continue;
            }
            if (fdate.getMonth() + 1 != m) {
                this._dates.each(function(item){
                    if (item.year == fdate.getFullYear()) {
                        item.months.push(fdate.getMonth() + 1);
                        m = fdate.getMonth() + 1;
                    }
                });
            }
        }
        
    },
    
    getValidDays: function(year, month){
        var mlen = this._maymonth[month - 1];
        if ((year % 4 == 0 && year % 100 != 0 || year % 400 == 0) && month == 2) 
            mlen++;
        return mlen;
    },
    
    checkValidDateTime: function(str){
        //this.fromString( str );
        sobj = this._selectDate.getTime();
        if (sobj < this._min_target || sobj > this._max_target) {
            delete dobj;
            return false;
        }
        delete dobj;
        return true;
    },
    
    isValidDay: function(year, month, day){
        month--;
        var dobj = new Date();
        dobj.setFullYear(year);
        dobj.setMonth(month);
        dobj.setDate(day);
        var sobj = dobj.getTime();
        if (sobj < this._min_target || sobj > this._max_target) {
            delete dobj;
            return false;
        }
        delete dobj;
        return true;
    },
    
    // param year 四位的数字
    setYear: function(year){
        this._selectDate.setFullYear(year);
    },
    
    setMonths: function(month){
        var m = this._trim0(month);
        m--;
        this._selectDate.setMonth(m);
    },
    
    setDay: function(day){
        this._selectDate.setDate(day);
    },
    
    setHour: function(hour){
        this._selectDate.setHours(hour);
    },
    
    setMinute: function(minute){
        this._selectDate.setMinutes(minute)
    },
    
    _formatstr: function(str){
        if (str < 10) {
            return ("0" + str);
        }
        return str;
    },
    
    _trim0: function(str){
        if (str[0] == "0") {
            return str[1];
        }
        return str;
    },
    
    getYear: function(){
        return this._selectDate.getFullYear();
    },
    
    getMonths: function(format){
        var m = this._selectDate.getMonth();
        m++;
        if (format == 0) {
            return this._formatstr(m);
        }
        return m;
    },
    
    getDay: function(format){
        if (format == 0) {
            return this._formatstr(this._selectDate.getDate());
        }
        return this._selectDate.getDate();
        
    },
    
    getHour: function(format){
        if (format == 0) {
            return this._formatstr(this._selectDate.getHours());
        }
        return this._selectDate.getHours();
        
    },
    
    getMinute: function(format){
        if (format == 0) {
            return this._formatstr(this._selectDate.getMinutes());
        }
        return this._selectDate.getMinutes();
        
    },
    
    getSelectDateObject: function(){
        return this._selectDate;
    },
    
    correctMonth: function(){
        this.setMonths(this.getMonth() + 1);
    },
    
    getValidDates: function(){
        return this._dates;
    },
    getLMonth: function(format){
        if (format == 0) {
            var m = this._selectDate.getMonth();
            m++;
            return this._formatstr(m);
        }
        return this._selectDate.getMonth();
    },
    toString: function(){
        str = '';
        str += this.getYear(0);
        str += this.getMonths(0);
        str += this.getDay(0);
        str += this.getHour(0);
        str += this.getMinute(0);
        return str;
    },
    fromString: function(str, format){
        delete this._selectDate;
        this._selectDate = new Date();
        this.setYear(str.substr(0, 4));
        var m = str.substr(4, 2);
        this.setMonths(m);
        this.setDay(str.substr(6, 2));
        this.setHour(str.substr(8, 2));
        this.setMinute(str.substr(10, 2));
    },
    toDisplayFormat: function(){
        return this.getYear(0) + "年" + this.getMonths(0) + "月" + this.getDay(0) + "日" + this.getHour(0) + " 时" + this.getMinute(0) + "分";
    }
};
//var sot_date = new SOTDate();



var SendOnTime = Class.create();
SendOnTime.prototype = {
    //初始化
    initialize: function(){
        this.sot_date = new SOTDate();
        this.validDates = this.sot_date.getValidDates();
        this._hide = 0;
        this._is_init = 0;
        this._checkid = "";
        this._container = "";
        this._filepath = '';
        this._mod = '0';
        this._fid = 0;
    },
    
    initUIString: function(){
        delete this.sot_date;
        this.sot_date = new SOTDate();
        this.setSelect(false);
        this.create();
        this.validDates = this.sot_date.getValidDates();
        //this.initUIString();
        this._hide = 0;
        this._is_init = 0;
        
        
        //用于保存状态
        this._filepath = '';
        this._mod = '0';
        this._fid = 0;
        
        //初始化年份
        var str = "";
        for (var i = 0; i < this.validDates.length; ++i) {
            str += "<option value=\"" + this.validDates[i].year + "\">" + this.validDates[i].year + "</option>";
        }
        $("sot_ui_year").update(str);
        //初始化月份,默认初始化第一年的月份
        str = "";
        for (i = 0; i < this.validDates[0].months.length; ++i) {
            str += "<option value=\"" + this.validDates[0].months[i] + "\">" + this.validDates[0].months[i] + "</option>";
        }
        $("sot_ui_month").update(str);
        //初始化日期
        str = "";
        for (var i = 1; i < 32; ++i) {
            str += "<option value=\"" + i + "\">" + i + "</option>";
        }
        $("sot_ui_day").update(str);
        
        //初始化小时
        str = "";
        for (var i = 0; i < 24; ++i) {
            str += "<option value=\"" + i + "\">" + i + "</option>";
        }
        $("sot_ui_hour").update(str);
        
        //初始化分钟
        str = "<option value=\"0\">0</option><option value=\"30\">30</option>";
        $("sot_ui_min").update(str);
        
        //设置上当前的日期
        //按照文档要求，小时和分钟应该设置为两个0
        this.sot_date.setHour(0);
        this.sot_date.setMinute(0);
        this.setTimeBar();
        this._setBarSelected("sot_ui_day", (this.sot_date.getDay() + 1));
        //给年份绑上事件
        Event.observe("sot_ui_year", "change", this._redrawMonth.bindAsEventListener(this));
        //给月份绑上事件，根据月份修改日期
        Event.observe("sot_ui_month", "change", this._redrawDay.bindAsEventListener(this));
        //默认隐藏掉
        this.hide();
        
        
        //初始化完毕
        this._is_init = 1;
        try{
            if(write_mail_single_flag == 1){
                $('static_cc').innerHTML =' <a href="javascript:;" onclick="writemail.cc_toggle(\'mail.cc\', \'compose.wcc\');return false;" class="black">抄送</a>';
                $('static_bcc').innerHTML = '<a href="javascript:;"  onclick="writemail.cc_toggle(\'mail.bcc\', \'compose.wbcc\');return false;" class="black">密送</a>';
                $('compose.wto').previousSibling.innerHTML = "收件人：";
                Element.show(DOM.compose_wto.nextSibling);
                Element.show(DOM.compose_wto.nextSibling.nextSibling);
                Element.hide(DOM.compose_wto.nextSibling.nextSibling.nextSibling);
                write_mail_single_flag = 0;
            }
        }catch(e){}
    },
    
    checkValid: function(str){
        var dstr = '';
        if (str == undefined || str == '') {
            str = this.getSelectValue();
        }
        return this.sot_date.checkValidDateTime(str);
    },
    
    _redrawDay: function(){
        var stryear = this._getSelectValue("sot_ui_year");
        var strmonth = this._getSelectValue("sot_ui_month");
        var validdays = this.sot_date.getValidDays(stryear, strmonth);
        var str = "";
        for (var q = 1; q <= validdays; ++q) {
            if (this.sot_date.isValidDay(stryear, strmonth, q) == false) {
                str += "<OPTGROUP  label=\"" + q + "\"   style=\"color:#cccccc;font-wight:normal;font-style: normal; font-size:12px;\" ></OPTGROUP >";
            }
            else {
                str += "<option value=\"" + q + "\"  color=\"cccccc\" >" + q + "</option>";
            }
            
        }
        $("sot_ui_day").update(str);
        //var oplists = $( "sot_ui_day" ).options.item( 0 );
        //oplists.disabled = !oplists.disabled;
    },
    _getSelectValue: function(id){
        return $(id).options[$(id).selectedIndex].value;
    },
    
    //当年修改的时候，修改它的可用月份
    _redrawMonth: function(){
        var stryear = this._getSelectValue("sot_ui_year");
        var str = "";
        for (var i = 0; i < this.validDates.length; ++i) {
            if (this.validDates[i].year == stryear) {
                var m_len = this.validDates[i].months.length;
                for (var q = 0; q < m_len; ++q) {
                    str += "<option value=\"" + this.validDates[i].months[q] + "\">" + this.validDates[i].months[q] + "</option>";
                }
                $("sot_ui_month").update(str);
                this._redrawDay();
                return;
            }
        }
    },
    _setBarSelected: function(option_id, value){
        var opobj = $(option_id);
        for (var i = 0; i < opobj.length; ++i) {
            //这里是按照value来判断，注释一个按照显示值来判断的
            if (opobj.options[i].value == value) {
                opobj.selectedIndex = i;
                return;
            }
        }
        return 0;
    },
    
    setTimeBar: function(){
        this._setBarSelected("sot_ui_year", this.sot_date.getYear());
        this._redrawMonth();
        this._setBarSelected("sot_ui_month", this.sot_date.getMonths());
        this._redrawDay();
        this._setBarSelected("sot_ui_day", this.sot_date.getDay());
        this._setBarSelected("sot_ui_hour", this.sot_date.getHour());
        this._setBarSelected("sot_ui_min", this.sot_date.getMinute());
        
    },
    //显示
    show: function(){
        Element.show($(this._container));
        this._hide = 1;
    },
    
    create: function(){
        var dis_str = '<select  id="sot_ui_year"> </select> 年' +
        '<select  id="sot_ui_month"></select>月' +
        '<select id="sot_ui_day"></select>日' +
        '<select id="sot_ui_hour"> </select> 时' +
        '<select id="sot_ui_min"> </select>分';
        $(this._container).update(dis_str);
    },
    
    destory: function(){
        $(this._container).update("");
        
    },
    
    //隐藏
    hide: function(){
        Element.hide($(this._container));
        this._hide = 0;
    },
    
    //设置按钮的选中状态
    setSelect: function(status){
        $(this._checkid).checked = status;
        if (status == true) {
            if (this._is_init == 0) {
                this.initUIString();
            }
            this.show();
        }
        else {
            this.hide();
        }
    },
    
    setStartTime: function(str, format){
        if (this._is_init == 0) {
            this.initUIString();
        }
        this.sot_date.fromString(str, format);
        this.setTimeBar();
    },
    
    //修改状态
    changeState: function(){
        var item = $(this._checkid);
        if ($(this._checkid).checked) {
            try{
                if(write_mail_dispostion_flag == 1){
                _dialog.confirm({info: '回执功能不能同时使用，将被取消。', click: function(){
                	write_mail_dispostion_flag = 0;
                        $('disposition_notifier').checked = false;
                	sendontime.show();
                },
				cancelclick: function(){
                	write_mail_dispostion_flag = 1;
                        $('disposition_notifier').checked = true;
            		var item = $(sendontime._checkid);
            		item.checked = false;
            		sendontime.hide();

                }
                });
                }
                if(write_mail_single_flag == 1){
                _dialog.confirm({info: '分送功能不能同时使用，将被取消。', click: function(){
                	$('static_single').innerHTML = '<a class="s_single_send black" style="cursor:pointer;">分送</a>';
			    	Element.hide(DOM.compose_wto.nextSibling.nextSibling.nextSibling);
                	write_mail_single_flag = 0;
                	$('static_cc').innerHTML =' <a href="javascript:;" onclick="writemail.cc_toggle(\'mail.cc\', \'compose.wcc\');return false;" class="black">抄送</a>';
                	$('static_bcc').innerHTML = '<a href="javascript:;"  onclick="writemail.cc_toggle(\'mail.bcc\', \'compose.wbcc\');return false;" class="black">密送</a>';
                	$('compose.wto').previousSibling.innerHTML = "收件人：";
                	$('static_single').innerHTML = '<a class="s_single_send black" style="cursor:pointer;">分送</a>';
                	sendontime.show();
                },
				cancelclick: function(){
                    $('static_cc').setStyle({'color':'#ccc', 'size' : '14px'});
                    $('static_cc').innerHTML = "抄送";
                    $('static_bcc').setStyle({'color':'#ccc', 'size' : '14px'});
                    $('static_bcc').innerHTML = "密送";
                    $('compose.wto').previousSibling.innerHTML = "分送给：";
                    $('static_single').innerHTML = '<a class="s_single_send black" style="cursor:pointer;">取消</a>';
            		var item = $(sendontime._checkid);
            		item.checked = false;
            		sendontime.hide();
				}
                });
                }else{
                sendontime.show();
                }
            }catch(e){}
        } else {
            try{
			    Element.show(DOM.compose_wto.nextSibling.nextSibling.nextSibling);
                $('static_single').innerHTML = '<a class="s_single_send black" style="cursor:pointer;">分送</a>';
            }catch(e){}
            this.hide();
        }
    },
    
    //设置Checkbox的ID和所有Select的父ID，并且添加监听事件
    setCheckBox: function(check_id, containerid){
        if (this.is_init == 1) {
            this.initUIString();
            return;
        }
        this._checkid = check_id;
        this._container = containerid;
        Event.observe(check_id, "click", this.changeState.bindAsEventListener(this));
        if (this._is_init == 0) {
            this.initUIString();
        }
    },
    
    _getSingleSelectValue: function(id, pos){
        var opobj = $(id);
        var value = opobj.options[opobj.selectedIndex].value;
        eval('this.sot_date.set' + pos + ' ( ' + value + ');');
        
    },
    
    isChecked: function(){
        return $(this._checkid).checked;
    },
    setFilePath: function(filePath){
        this._filepath = filePath;
        return;
    },
    getFilePath: function(){
        return this._filepath;
    },
    setMod: function(is_mod){
        this._mod = is_mod;
        return;
    },
    getMod: function(){
        return this._mod;
    },
    getDBID: function(){
        return this._fid;
    },
    
    setDBID: function(id){
        this._fid = id;
        return;
    },
    
    getSelectValue: function(){
        //设置年
        this._getSingleSelectValue("sot_ui_year", 'Year');
        //设置月
        this._getSingleSelectValue("sot_ui_month", 'Months');
        //设置日
        this._getSingleSelectValue("sot_ui_day", 'Day');
        //设置小时
        this._getSingleSelectValue("sot_ui_hour", 'Hour');
        //设置分钟
        this._getSingleSelectValue("sot_ui_min", 'Minute');
        
        return this.sot_date.toString();
    },
    getDisplayDate: function(){
        return this.sot_date.toDisplayFormat();
    }
};
var sendontime = new SendOnTime();

var SOTLoader = Class.create();
SOTLoader.prototype = {
    initialize: function(){
        this.sot_userid = '';
        this.id = 0;
        this.filepath = 0;
        this.sot_date = '';
        try {
            this.sot_userid = UserSohuID;
        } 
        catch (e) {
        }
    },
    
    getList: function(){
        try {
            this.sot_userid = UserSohuID;
        } 
        catch (e) {
        }
        var params = {
            senderid: this.sot_userid,
            proxyaction: 'list'
        };
        sotProxy(params, this.getListFunc.bind(this), this.getListFunc.bind(this));
        
    },
    getListFunc: function(ret){
        if (ret.is_success) {
            var t = new Template(SOTMailListTemplate);
            var data = new Object();
            if (ret.data == "") {
                data['mails'] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;您尚未设置定时发送的邮件';
            }
            else {
                var pattern = new RegExp("[^<^>]*@.[^<^>]*");
                var tmpdate = new SOTDate();
                var datas = (ret.data).evalJSON();
                hiddenAllPanel();
                $('mailConfiguration').show();
                changeToolbarStyle();
                data['mails'] = '';
                var clickcmd = '';
                var receivers = '';
                data['cards'] = '';
                
                for (var i = 0; i < datas.length; ++i) {
                    var p_index = 0;
                    var laststr = '';
                    var emails = datas[i][1];
                    var bccstr = (emails.split("bcc:"))[1];
                    laststr = (emails.split("bcc:"))[0];
                    var ccstr = (laststr.split("cc:"))[1];
                    laststr = (laststr.split("cc:"))[0];
                    if (datas[i][9] == 1) 
                        var to = (laststr.split("to:"))[1];
                    else 
                        var to = laststr;
                    
                    var disto = '';
                    var discc = '';
                    var disbcc = '';
                    var comstr = bccstr;
                    
                    if (bccstr == undefined) {
                        comstr = "  ";
                    }
                    comstr = this.coder(comstr);
                    
                    var tos = to.split(",");
                    for (var m = 0; m < tos.length; ++m) {
                        if (tos[m].length > 0) {
                            pattern.test(tos[m]);
                            var str = pattern.exec(tos[m]);
                            disto += "<a href='mailto:" +
                            str +
                            "'>" +
                            str +
                            '</a>  &nbsp;&nbsp;&nbsp;';
                        }
                    }
                    if (ccstr) {
                        tos = ccstr.split(",");
                        for (var m = 0; m < tos.length; ++m) {
                            if (tos[m].length > 0) {
                                pattern.test(tos[m]);
                                var str = pattern.exec(tos[m]);
                                discc += "<a href='mailto:" +
                                str +
                                "'>" +
                                str +
                                '</a>  &nbsp;&nbsp;&nbsp;';
                            }
                        }
                    }
                    if (bccstr) {
                        tos = bccstr.split(",");
                        for (var m = 0; m < tos.length; ++m) {
                            if (tos[m].length > 0) {
                                pattern.test(tos[m]);
                                var str = pattern.exec(tos[m]);
                                disbcc += "<a href='mailto:" +
                                str +
                                "'>" +
                                str +
                                '</a>  &nbsp;&nbsp;&nbsp;';
                            }
                        }
                    }
                    
                    if (datas[i][9] == 1) {
                        clickcmd = '';
                        clickcmd += "sot_load.SOTDraft2Write(" +
                        datas[i][5] +
                        "," +
                        datas[i][0] +
                        ", '" +
                        datas[i][4] +
                        "','" +
                        datas[i][3] +
                        "','" +
                        comstr +
                        "' );";
                        tmpdate.fromString(datas[i][3]);
                        data['mails'] += '<dl id="SOT_LIST_' + datas[i][0] + '"><dd>收件人：' +
                        disto +
                        ' <span>' +
                        '<input type="button"  class="yes" onclick="' +
                        clickcmd +
                        '"' +
                        'value=" 编 辑 "/>' +
                        '<input type="button" onclick="sot_load.DelSingleSOT( ' +
                        datas[i][0] +
                        ", '" +
                        datas[i][4] +
                        "' );\"  class=\"yes\" value=\" 删 除\" /></span></dd>";
                        
                        if (discc.length > 0) {
                            data['mails'] += '<dd>抄送：' + discc + '</dd>';
                        }
                        
                        if (disbcc.length > 0) {
                            data['mails'] += '<dd>密抄：' + disbcc + '</dd>';
                        }
                        
                        
                        
                        data['mails'] += ' <dd>主　题：' +
                        datas[i][2] +
                        '</dd><dd>设置时间：' +
                        tmpdate.toDisplayFormat() +
                        '</dd>	</dl>';
                    }
                    else 
                        if (datas[i][9] == 0) {
                            tmpdate.fromString(datas[i][3]);
                            data['cards'] += '<dl id="SOT_LIST_' + datas[i][0] + '" ><dd>收件人：' +
                            disto +
                            ' <span>'                        //		+ '<input type="button"  class="yes" onclick="' + clickcmd +'"'
                            //		+ 'value=" 编 辑 "/>'
                            +
                            '<input type="button" onclick="sot_load.DelSingleSOT( ' +
                            datas[i][0] +
                            ", '" +
                            datas[i][4] +
                            "', 0 );\"  class=\"yes\" value=\" 删 除\" /></span></dd>";
                            
                            if (disbcc.length > 0) {
                                data['cards'] += '<dd>密抄：' + disbcc + '</dd>';
                            }
                            
                            if (discc.length > 0) {
                                data['cards'] += '<dd>抄送：' + discc + '</dd>';
                            }
                            
                            data['cards'] += ' <dd>主　题：' +
                            datas[i][2] +
                            '</dd><dd>设置时间：' +
                            tmpdate.toDisplayFormat() +
                            '</dd>	</dl>';
                        }
                    
                }
                
                
                delete tmpdate;
            }
        }
        else {
            // alert( "网络错误,请稍后再试" );
            _dialog.alert({
                info: '网络错误,请稍后再试'
            });
        }
        $('mailConfiguration').update(t.evaluate(data));
    },
    
    sot_writenew: function(){
        // composeMailNew();
        changePanel('composeMail');
        (function(){
            var _sf = arguments.callee;
            var __t = setTimeout(function(){
                var _sc = $('sot_control');
                if (!_sc) {
                    try{
                    Element.hide(DOM.compose_wto.nextSibling.nextSibling.nextSibling);
                    }catch(e){}
                    _sf();
                    return false;
                }
                try{
			        Element.hide(DOM.compose_wto.nextSibling.nextSibling.nextSibling);
                }catch(e){}
                sendontime.setSelect(true);
            }, 100);
        })();
        
    },
    
    coder: function(str){
        var s = "";
        if (str.length == 0) 
            return "";
        for (var i = 0; i < str.length; i++) {
            switch (str.substr(i, 1)) {
                case "<":
                    s += "&lt;";
                    break;
                case ">":
                    s += "&gt;";
                    break;
                case "&":
                    s += "&amp;";
                    break;
                case "   ":
                    s += "&nbsp;";
                    break;
                case "\"":
                    s += "&quot;";
                    break;
                case "\n":
                    s += "<br>";
                    break;
                default:
                    s += str.substr(i, 1);
                    break;
            }
        }
        return s;
    },
    
    DelSingleSOT: function(id, filepath, type){
        var str = "邮件";
        var d_type = 1;
        if (type == 0) {
            str = "贺卡";
            d_type = 0;
        }
        if (confirm("您确定要永久删除此" + str + "吗？ ") == false) {
            return false;
        }
        var params = {
            id: id,
            proxyaction: 'del',
            delpath: filepath,
            type: d_type
        
        };
        sotProxy(params, this.DelFunc.bind(this), this.DelFunc.bind(this));
    },
    
    DelFunc: function(ret){
        if (ret.is_success) {
            var item = $('SOT_LIST_' + ret.data);
            item.style.display = 'none';
        }
        else {
            switch (ret.error) {
                case -5:
                    _dialog.alert({
                        info: "记录已经被删除，请勿重复点击"
                    });
                default:
                    _dialog.alert({
                        info: "网络错误，请稍后再试!"
                    });
            }
        }
    },
    
    SOTDraft2Write: function(backup, id, path, date, bccstr){
        if (!bccstr) {
            bccstr = '';
        }
        var params = {
            draftpath: path,
            proxyaction: 'draft2write',
            sot_date: date,
            sot_id: id,
            bcc: bccstr,
            sot_back: backup
        }
        sotProxy(params, this.SOTDraft2WriteFunc.bind(this), this.SOTDraft2WriteFunc.bind(this));
    },
    
    SOTDraft2WriteFunc: function(ret) {
        writemail.sotDraft2WriteCallBack(ret);
        sendontime.setCheckBox('sot_control', 'sohu_sot_container');
        sendontime.setStartTime(ret.sot_date, 1);
        sendontime.setSelect(true);
        if (ret.sot_back == 1) {
            DOM.saveCheckbox1.checked = true;
            try{
                Element.hide(DOM.compose_wto.nextSibling.nextSibling.nextSibling);
            }catch(e){}
        } else {
            DOM.saveCheckbox1.checked = false;
            try{
                Element.hide(DOM.compose_wto.nextSibling.nextSibling.nextSibling);
            }catch(e){}
        }
        sendontime.setFilePath(ret.sot_file);
        sendontime.setDBID(ret.sot_id); 
        sendontime.setMod('1');
    }
    
};
var sot_load = new SOTLoader();
